<!-- 头部通用组件 -->
<template>
	<!-- #ifdef APP-PLUS -->
	<view :class="isFixed?'fixed':'header'" :style="{'background':bgColor}">
		<view class="header_content" :style="{'color':titleColor}">
			<view @click="$emit('back')">
				<u-icon name="arrow-left" size="40rpx" :color="arrowColor"></u-icon>
			</view>
			<text :style="{'color': textColor}">{{title}}</text>
			<view v-if="isShowRight" class="right" @click="$emit('rightCb')">{{rightText}}</view>
			<view v-else></view>
		</view>
	</view>
			<!-- #endif -->
</template>

<script>
	export default {
		props: {
			bgColor: {
				type: String,
				default: 'transparent'
			},
			title: {
				type: String,
			},
			rightText: {
				type: String,
			},
			isShowRight: {
				type: Boolean,
				default: true
			},
			// 头部整体文字颜色
			titleColor: {
				type: String,
				default: '#fff'
			},
			//中间文本颜色
			textColor: {
				type: String,
				default: '#fff'
			},
			//箭头颜色
			arrowColor: {
				type: String,
				default: '#fff'
			},
			//是否固定在顶部
			isFixed:{
				type: Boolean,
				default: true
			}
		}
	}
</script>

<style lang="scss" scoped>
	.fixed{
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		z-index: 999;
	}
	.header,.fixed {
		padding: calc(var(--status-bar-height) + 30rpx) 30rpx 30rpx;
		.header_content {
			display: flex;
			justify-content: space-between;
			align-items: center;
			&>view {
				width: 120rpx;
			}

			text {
				font-size: 32rpx;
				font-weight: bold;
				text-align: center;
				flex: 1;
			}

			.right {
				font-size: 28rpx;
			}
		}

		;
	}
</style>
